package com.zhuizikejithreeig.cn.threeigkeji.loginfo;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.zhuizikejithreeig.cn.threeigkeji.BasicActivity;
import com.zhuizikejithreeig.cn.threeigkeji.R;

public class Agreement  extends BasicActivity  {

    private WebView     mWebView;
    private WebSettings mSettings;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView_V(R.layout.activity_agreement);
        mWebView = (WebView) findViewById(R.id.webview);
        showBody();
        //不会弹出系统浏览器,只会在本地浏览器中进行展示
        mWebView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {


                return true;
            }

            //网页加载前
            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                super.onPageStarted(view, url, favicon);
            }

            //网页加载后
            @Override
            public void onPageFinished(WebView view, String url) {
                super.onPageFinished(view, url);
            }
        });

        //跟上面方法一起用，能在本应用中进行弹出界面，而不会跳转其他app
        mWebView.setWebChromeClient(new WebChromeClient() {

            //网页加载的进度返回
            @Override
            public void onProgressChanged(WebView view, int newProgress) {
                super.onProgressChanged(view, newProgress);
            }

            //获取网页的标题
            @Override
            public void onReceivedTitle(WebView view, String title) {
                super.onReceivedTitle(view, title);
            }
        });

        mWebView.loadUrl("file:///android_asset/demo.html");

        mSettings = mWebView.getSettings();

        //设置支持js功能才能弹广告
        mSettings.setJavaScriptEnabled(true);
        //显示缩放按钮（wap网页不支持）
        mSettings.setBuiltInZoomControls(false);
        //支持双击缩放（wap网页不支持）
        mSettings.setUseWideViewPort(false);
    }
}
